﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class XemChiTietSanPham : System.Web.UI.Page
{
    private DataSet objDataSet;
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadControl();
        UpdateSoLanXem();
    }

    public void UpdateSoLanXem()
    {
        string id = Request.QueryString["id"];
        SanPhamBUS objSanPham = new SanPhamBUS(TGDDConfiguration.DbConnectionString);
        objSanPham.UpdateSoLanXem(int.Parse(id));
    }

    private void LoadControl()
    {
        string loaisp = Request.QueryString["loaisp"];
        LoaiSanPhamBUS objLoaiSP = new LoaiSanPhamBUS(TGDDConfiguration.DbConnectionString);
        objDataSet = objLoaiSP.SelectTenLoaiSanPham(int.Parse(loaisp));
        DataRow row = objDataSet.Tables[0].Rows[0];
        string tenloaisp = row["TenLoaiSanPham"].ToString();
        Control c = Page.LoadControl(Request.ApplicationPath +
                       "/UserControls/TH_XemChiTietSanPham.ascx");
        sanPhamPlaceHolder.Controls.Add(c);
    }

}
